home *** CD-ROM | disk | FTP | other *** search
-
- ~4Dgifts/toolbox/src/exampleCode/irix/scripts README
-
-
- contained herein are various c-shell scripts created/used by colleagues
- that might possibly be useful to others, if for no other purpose than
- examples of shell programming source.
-
-
- rcs : directory of scripts written to facilitate manipulation of
- source trees employing RCS.
-
-
- counts : reads stdin and tells which header files are called by
- which source files.
-
- Synopsis:
- counts.csh < make.deps
-
- Use:
- Sometimes, it is necessary to add a #define or
- #include file to all the source files in the
- current directory. If the number of source
- files is large, this can become quite a job.
-
- This script was generated to find which header
- file is included by the largest number of
- source files so that the #define or #include
- can be added to this header file, rather than
- to each of the source files.
-
- The make.deps file is just a list of the
- dependent files as generated for a makefile.
-
- To make the make.deps file, do the following:
-
- cc -M $(CFLAGS) *.[fc] | grep -v '/usr/include' > make.deps
-
-
-
-
-
- ddir : Script which performs an 'ls' showing only
- subdirectories in the current directory.
-
-
-
-
-
- edir : Script which performs an 'ls' showing only executable
- files in the current directory.
-
-
-
-
-
- findlogins scans /usr/adm/SYSLOG for every entry entered by 'login'.
- It will keep track of each different user and count the
- number of times each has logged in.
-
- Synopsis:
- findlogins [<file>]
- where:
- <file> Optionally specifies the file to scan.
- If not specified, searches
- /usr/adm/SYSLOG.
-
- Use:
- This script is useful as a method of keeping
- track of who is using your machine. It will
- provide a running total of the times people
- log in. It can be run as a cron job once a
- week (the frequency that SYSLOG is copied to
- oSYSLOG).
-
-
-
-
-
- findu : scans all libraries and/or object files provided on
- the command line for undefined symbols. It is smart
- enough to match symbols that are defined in other
- libraries so that only the final undefined list is
- provided.
-
- Synopsis:
- findu lib1.a lib2.a ... libN.a > undef.syms
-
- Note: As a side function, this script appends to the
- file /usr/var/tmp/defines.h a list of macros to rename
- FORTRAN file names so they can be called from C. For
- example, if a C function calls the FORTRAN routine
- 'FORSUB', as in:
-
- forsub (parm1, parm2);
-
- This script will add the following line to the
- /usr/var/tmp/defines.h file:
-
- #define forsub forsub_
-
- Then the file defines.h can be copied and included in
- the C source files.
-
-
-
-
-
- getlogins Simple script gets all the login entries from the system
- log and sorts them.
-
-
-
-
-
- movetree : Script which will move an entire directory tree from
- one place to another. One of its advantages is that
- it maintains the owner, group and file times for the
- files that are moved. This script uses tar(1) to
- perform the move.
-
- Synopsis:
- movetree [-v] [-n] <source-dir> [<dest-dir>]
-
- Where:
- -v Set the -v option on tar.
- -n Do not delete the source
- directory tree when done.
- <source-dir> Full path to the source
- directory.
- <dest-dir> If specified, the full
- path to the directory into
- which the source directory
- is to be copied. This
- directory must exist. If
- not specified, copies to
- the current directory.
-
-
-
-
-
- replace : Script to replace a string with a new string in a list
- of files. Sort of a global find-and-replace.
-
- Synopsis:
- replace <search-string> <replace-string> <file-list>
-
- Where:
- <search-string> Is a regular expression (as
- used in ed(1)) that is
- supposed to be found in the
- list of files.
- <replace-string> Is the string that is to
- replace <search-string>.
- <file-list> List of files to perform the
- search-and-replace on.
-
-
-
-
-
- setup : Startup script for one of the engineers here at SGI.
- This script is called from .cshrc and .login to
- initialize the user's environment. It performs
- different things depending on whether it is called
- from .cshrc or .login.
-
- This script is provided mostly as an example of things
- that can be done during startup to initialize a user's
- environment and isn't necessarily intended to be used
- (though it can be).
-
- Synopsis:
- Add the following to your .login file:
- if ( -e setup ) then
- set login
- source setup
- unset login
- endif
-
- Add the following to your .cshrc file:
- if ( -e setup ) then
- set cshrc
- source setup
- unset cshrc
- endif
-
- How to use:
- First, you must edit the file and change the
- definition for 'home_host' to the hostname of
- the user's home machine. In the environment
- of the originator of this script, he had a
- home machine where he normally worked as well
- as a number of other machines that he had
- access to. This variable is set to his home
- hostname so that when this script is copied to
- all the other machines, certain things happen
- only on his home machine.
-
- Find the line 'set home_host = heaven' and
- change it to 'set home_host = ???', replacing
- the '???' to the hostname of your home
- machine.
-
- Functions performed:
- The following functions are performed by this
- script:
-
- 1) Determines the terminal type. If the
- terminal type cannot be determined, sets
- it to vt100. Specifically, this was used
- when logging in over a modem.
-
- 2) If the environment variable ENVONLY is
- defined, only performs steps that set up
- the environment. This speeds the process
- for the 'userenv(1)' command which is
- called by X when the user logs in to the
- graphics monitor.
-
- 3) If the environment variable INEMACS is
- defined, does not do pretty printing
- functions that cause a bunch of control
- codes to be sent to the screen. These
- codes make it difficult for EMACS to parse
- when found in the '*compilation*' window
- of EMACS.
-
- 4) Sets the DISPLAY environment variable to
- the appropriate value. If this session is
- a remote login, sets the DISPLAY to the
- remote machine. If the session is not an
- X session, removes the DISPLAY environment
- variable definition.
-
- 5) Sets the environment variable
- EMACSLOADPATH.
-
- 6) Sets the environment variable WINEDITOR to
- use EMACS.
-
- 7) Sets the environment variable LPDEST to
- the default printer defined.
-
- 8) If Explorer is installed, sets the
- environment EXPLORERHOME.
-
- 9) If the environment variable XSCREEN is
- defined and refers to the screen size AND
- the files $HOME/.Xdefaults_1280 or
- $HOME/.Xdefaults_1024 exist, sets the
- environment variable XENVIRONMENT to the
- appropriate file. This allows the user to
- define a different .Xdefaults file to be
- used depending on the screen size.
-
- 10) Sets the PATH environment variable to
- include directories (but only if they
- exist). This function requires the
- existence of the 'unique' command provided
- elsewhere on this CD.
-
- 11) If run from .cshrc, performs steps 13-15.
-
- 12) If run from .login, performs steps 16-17.
-
- 13) Sets the prompt to include the hostname,
- username and history. If the terminal
- type supports colors or highlighting, uses
- the colors and reverse video if running
- with root privileges.
-
- 14) Sets a number of csh variables.
-
- a) history - to keep a history of
- commands to be re-used with csh's
- history mechanism.
- b) cdpath - Includes subdirectories to
- automatically be searched when the
- 'cd' command is entered.
- c) filec - enables file completion.
- d) fignore - lists files to be ignored
- during file completion.
-
- 15) Sets a number of aliases.
-
- a) ls - To print with specific
- options.
- b) ll - Same as 'ls' with -l option.
- c) lt - Same as 'll' with -t option.
- d) mail - Points to BSD mailer.
- e) If using X, sets up to run EMACS,
- epoch and zmail automatically in
- the background.
- f) If not using X, sets up EMACS to
- run in vt100 mode and disables
- epoch.
- g) If the scripts exist, aliases co,
- col and ci to the appropriate
- scripts (see the 'rcs' subdirectory
- in this subdirectory).
- h) unlock - Performs an unlock on an
- RCS file and removes the working
- file.
- i) If running in the X window system,
- creates the aliases in steps j-k.
- j) seticon - Command to set the string
- to be used as the label for the
- icon for this shell window.
- k) settitle - Command to set the
- string to be used as the title for
- this shell window.
- l) If running in the X window system,
- creates the aliases in steps m-r so
- they run their equivalent command
- but when they complete, resets the
- title of the window to indicate the
- current working directory. If the
- environment variable CONSOLE is
- true, also adds information to the
- title to indicate it is the console
- window.
- m) cu
- n) cd
- o) rlogin
- p) rsh
- q) pushd
- r) popd
- s) etags - Always include the -t
- option.
- t) snoop - Run the demo snoop.
- u) bu - Backs up one directory. This
- is different from 'cd ..' in that
- it works if the current directory
- was accessed through a symbolic
- link.
-
- 16) Sets an initial title for the window.
-
- 17) Because of conflicts with EMACS, unbinds
- the SGI definitions for the function keys
- f3 and f4.
-
-
-
-
-
- treegrep fgrep a string through an entire directory tree.
-
- Synopsis:
- treegrep <dir> <str> <file-spec>
-
- Where:
- <dir> is the top directory to start in.
- <str> is the string to fgrep for.
- <file-spec> is the file specification to fgrep
- through. Note wild cards must be escaped.
-
-
-
-
-
- update.hosts : This script is used by an engineer to make sure that
- his window/shell environment is the same on all the
- machines in his network. It is run nightly in a cron
- job to make sure that anything changed on his home
- machine is copied to all the other machines on the
- network that the engineer has access to.
-
- Synopsis:
- update.hosts [<host>]
-
- Description:
- If run without parameters, uses the list of
- hosts in the $HOME/.rhosts file. Otherwise,
- updates the information on the host specified.
-